package com.qding.park.adapter.report.valid;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.apache.commons.lang3.StringUtils;

public class OutOpTypeValid implements ConstraintValidator<OutOpType, String>{

    private OutOpType constraintAnnotation;
    @Override
    public void initialize(OutOpType constraintAnnotation) {
        this.constraintAnnotation=constraintAnnotation;
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        
        if(StringUtils.isBlank(value)){
            return true;
        }
        
        if("manual".equals(value)){
            return true;
        }else if("automatic".equals(value)){
            return true;
        }
        return false;
    }

}
